package org.jeecg.modules.htxincailiao.industry.domain.bo;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Objects;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.modules.htxincailiao.area.entity.HTArea;
import org.jeecg.modules.htxincailiao.area.service.IHTAreaService;
import org.jeecg.modules.htxincailiao.industry.constant.HTDateStatusEnum;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.util.oConvertUtils;

import javax.annotation.Resource;

/**
 * @Description: ht_industry_salon
 * @Author: jeecg-boot
 * @Date:   2021-08-25
 * @Version: V1.0
 */
@Data
@TableName("ht_industry_salon")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ht_industry_salon对象", description="ht_industry_salon")
public class HTIndustryEventBO implements Serializable {

    /**报名对象 0-展商 1-观众 */
    @Excel(name = "报名对象 0-展商 1-观众 ", width = 15)
    @ApiModelProperty(value = "报名对象 0-展商 1-观众 ")
    private Integer applyObjectType;


    /**买家ID*/
    @Excel(name = "买家ID", width = 15)
    @ApiModelProperty(value = "买家ID")
    private String buyerId;

    /**会议ID*/
    @ApiModelProperty(value = "会议ID")
    private String meetingId;

    /**展会ID*/
    @ApiModelProperty(value = "展会ID")
    private String exhibitionId;

    /**沙龙ID*/
    @ApiModelProperty(value = "沙龙ID")
    private String salonId;

    /**创建者ID*/
    @Excel(name = "创建者ID", width = 15)
    @ApiModelProperty(value = "创建者ID")
    private String creatorId;
    /**主办方*/
    @Excel(name = "主办方", width = 15)
    @ApiModelProperty(value = "主办方")
    private String organizer;
    /**标题*/
    @Excel(name = "标题", width = 15)
    @ApiModelProperty(value = "标题")
    private String name;
    /**副标题*/
    @Excel(name = "副标题", width = 15)
    @ApiModelProperty(value = "副标题")
    private String subname;
    /**内容*/
    @Excel(name = "内容", width = 15)
    @ApiModelProperty(value = "内容")
    private String content;
    /**封面*/
    @Excel(name = "封面", width = 15)
    @ApiModelProperty(value = "封面")
    private String cover;
    /**开始时间*/
    @Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date startTime;
    /**结束时间*/
    @Excel(name = "结束时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "结束时间")
    private Date endTime;
    /**省ID*/
    @Excel(name = "省ID", width = 15)
    @ApiModelProperty(value = "省ID")
    private String provinceId;
    /**市ID*/
    @Excel(name = "市ID", width = 15)
    @ApiModelProperty(value = "市ID")
    private String cityId;
    /**区ID*/
    @Excel(name = "区ID", width = 15)
    @ApiModelProperty(value = "区ID")
    private String districtId;
    /**街道地址*/
    @Excel(name = "街道地址", width = 15)
    @ApiModelProperty(value = "街道地址")
    private String streetAddress;
    /**楼/门牌号*/
    @Excel(name = "楼/门牌号", width = 15)
    @ApiModelProperty(value = "楼/门牌号")
    private String suiteAddress;

    /**审批者ID*/
    @Excel(name = "审批者ID", width = 15)
    @ApiModelProperty(value = "审批者ID")
    private String auditUserId;
    /**审批人*/
    @Excel(name = "审批人", width = 15)
    @ApiModelProperty(value = "审批人")
    private String auditUsername;
    /**审核状态：0-未审核 1-审核中 2-已通过 3-已驳回*/
    @Excel(name = "审核状态：0-未审核 1-审核中 2-已通过 3-已驳回", width = 15, dicCode = "audit_status")
    @Dict(dicCode = "audit_status")
    @ApiModelProperty(value = "审核状态：0-未审核 1-审核中 2-已通过 3-已驳回")
    private Integer auditStatus;
    /**审批意见*/
    @Excel(name = "审批意见", width = 15)
    @ApiModelProperty(value = "审批意见")
    private String auditComments;
    /**沙龙分类：0-全部 1-近期  2-进行中 3-往期 4-我参与的*/
    @Excel(name = "沙龙分类：0-全部 1-近期  2-进行中 3-往期 4-我参与的", width = 15, dicCode = "salon_category")
    @Dict(dicCode = "salon_category")
    @ApiModelProperty(value = "沙龙分类：0-全部 1-近期  2-进行中 3-往期 4-我参与的")
    private Integer salonCategory;
    /**首页推荐*/
    @Excel(name = "首页推荐", width = 15, dicCode = "is_home_recommended")
    @Dict(dicCode = "is_home_recommended")
    @ApiModelProperty(value = "首页推荐")
    private Integer isHomeRecommended;
    /**逻辑删除：1表示删除，0表示未删除。*/
    @Excel(name = "逻辑删除：1表示删除，0表示未删除。", width = 15)
    @ApiModelProperty(value = "逻辑删除：1表示删除，0表示未删除。")
    private Integer isDeleted;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**更新时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;


    /**签到二维码*/
    @Excel(name = "签到二维码", width = 15)
    @ApiModelProperty(value = "签到二维码")
    private String checkQrcodeUrl;
    /**报名费（单票价格）*/
    @Excel(name = "报名费（单票价格）", width = 15)
    @ApiModelProperty(value = "报名费（单票价格）")
    private BigDecimal applyCost;

    /**展商参展费*/
    @Excel(name = "展商参展费", width = 15)
    @ApiModelProperty(value = "展商参展费")
    private BigDecimal exhibitorCost;
    /**观众观展费*/
    @Excel(name = "观众观展费", width = 15)
    @ApiModelProperty(value = "观众观展费")
    private BigDecimal audienceCost;


    @TableField(exist = false)
    private Integer pageNo;

    @TableField(exist = false)
    private Integer pageSize;

    @TableField(exist = false)
    private HTDateStatusEnum dateStatus;

    public HTDateStatusEnum getDateStatus() {
        if(Objects.isNull(dateStatus)){
            dateStatus = HTDateStatusEnum.ALL;
        }
        return dateStatus;
    }

    static public String getProvinceName(HTIndustryEventBO eventBO, IHTAreaService areaService) {
        String name = null;
        if(oConvertUtils.isNotEmpty(eventBO) && oConvertUtils.isNotEmpty(areaService))
        if (oConvertUtils.isNotEmpty(eventBO.getProvinceId())){
            HTArea area = areaService.getById(eventBO.getProvinceId());
            name = oConvertUtils.isNotEmpty(area) ? area.getName() : null;
        }

        return name;
    }
    static public String getCityName(HTIndustryEventBO eventBO, IHTAreaService areaService) {
        String name = null;
        if(oConvertUtils.isNotEmpty(eventBO) && oConvertUtils.isNotEmpty(areaService))
        if (oConvertUtils.isNotEmpty(eventBO.getCityId())){
            HTArea area = areaService.getById(eventBO.getCityId());
            name = oConvertUtils.isNotEmpty(area) ? area.getName() : null;
        }

        return name;
    }

    static public String getDistrictName(HTIndustryEventBO eventBO, IHTAreaService areaService) {
        String name = null;
        if(oConvertUtils.isNotEmpty(eventBO) && oConvertUtils.isNotEmpty(areaService))
        if (oConvertUtils.isNotEmpty(eventBO.getDistrictId())){
            HTArea area = areaService.getById(eventBO.getDistrictId());
            name = oConvertUtils.isNotEmpty(area) ? area.getName() : null;
        }

        return name;
    }


    //
    static public  String buildFullAddressBy(HTIndustryEventBO eventBO, String provinceName, String cityName , String districtName ) {
        String address = "";
        String separator = " ";
        if (oConvertUtils.isNotEmpty(provinceName)) {
            address += provinceName;
        }
        if (oConvertUtils.isNotEmpty(cityName)) {
            address += (separator + cityName);
        }
        if (oConvertUtils.isNotEmpty(districtName)) {
            address += (separator + districtName);
        }
        if (oConvertUtils.isNotEmpty(eventBO.streetAddress)) {
            address += (separator + eventBO.streetAddress);
        }
        if (oConvertUtils.isNotEmpty(eventBO.suiteAddress)) {
            address += (separator + eventBO.suiteAddress);
        }

        return address;
    }

}
